home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Varsity Update 1998 August
/
SGI Varsity Update 1998 August.iso
/
dist
/
dist6.5
/
il_dev.idb
/
usr
/
include
/
il
/
ilBlendImg.h.z
/
ilBlendImg.h
Wrap
C/C++ Source or Header
|
1998-07-29
|
4KB
|
119 lines
#if 0
Copyright (c) 1991 SGI All Rights Reserved
THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI
The copyright notice above does not evidence any
actual or intended publication of such source code,
and is an unpublished work by Silicon Graphics, Inc.
This material contains CONFIDENTIAL INFORMATION that
is the property of Silicon Graphics, Inc. Any use,
duplication or disclosure not specifically authorized
by Silicon Graphics is strictly prohibited.
RESTRICTED RIGHTS LEGEND:
Use, duplication or disclosure by the Government is
subject to restrictions as set forth in subdivision
(c)(1)(ii) of the Rights in Technical Data and Computer
Software clause at DFARS 52.227-7013, and/or in similar
or successor clauses in the FAR, DOD or NASA FAR
Supplement. Unpublished- rights reserved under the
Copyright Laws of the United States. Contractor is
SILICON GRAPHICS, INC., 2011 N. Shoreline Blvd.,
Mountain View, CA 94039-7311
#endif
/*
ilBlendImg performs source alpha blending of two ilImages.
*/
#ifndef _ilBlendImg_h_
#define _ilBlendImg_h_
#include <il/ilPolyadicImg.h>
class ilMpBlendRequest : public ilMpPolyadicRequest {
public:
ilMpBlendRequest(ilMpManager* parent, int x, int y, int z, int c,
int mode = ilLMread)
: ilMpPolyadicRequest(parent, x, y, z, c, mode)
{ alphaBufPtr[0] = alphaBufPtr[1] = NULL; }
void* alphaBufPtr[2]; // array of alpha input buffers
};
class ilBlendImg : public ilPolyadicImg {
public:
iflClassListDeclare
~ilBlendImg();
// external api: begin
ilBlendImg(ilImage* fore = NULL, ilImage* bkgd = NULL,
ilCompose comp = ilAplusB);
// external api: name=ilBlendImgAlpha
ilBlendImg(ilImage* fore, ilImage* bkgd,
ilImage* alphaf, ilImage* alphab = NULL,
ilCompose comp = ilAplusB);
// external api: name=ilBlendImgConst
ilBlendImg(ilImage* fore, ilImage* bkgd, float alpha);
ilStatus setConstAlpha(float val);
float getConstAlpha() { return alpha; }
int usingConstAlpha();
ilStatus setAlphaPlane(ilImage* alpha);
ilImage* getAlphaPlane();
// external api: name=setAlphaPlanes
ilStatus setAlphaPlane(ilImage* alphaf, ilImage* alphab);
// external api: name=getAlphaPlanes
void getAlphaPlane(ilImage*& alphaf, ilImage*& alphab);
// set range for foreground alpha image
void setAlphaRange(float fmin, float fmax);
// external api: name=setAlphaRanges
// set range for foreground & background alpha images
void setAlphaRange(float fmin, float fmax, float bmin, float bmax);
void clearAlphaRange();
void getAlphaRange(float &fmin, float &fmax) { fmin = afmin; fmax = afmax; }
// external api: name=getAlphaRanges
void getAlphaRange(float &fmin, float &fmax, float &bmin, float &bmax)
{ fmin = afmin; fmax = afmax; bmin = abmin; bmax = abmax; }
void setBlendMode(ilCompose mode = ilAplusB);
ilCompose getBlendMode() { return comp; }
// external api: end
protected:
virtual ilHwOp* hwDefine();
virtual ilMpCacheRequest* getMpRequest(ilMpManager* parent,
int x, int y, int z, int c,
int mode=ilLMread);
virtual ilStatus prepareRequest(ilMpCacheRequest* req);
virtual ilStatus executeRequest(ilMpCacheRequest* req);
virtual ilStatus finishRequest(ilMpCacheRequest* req);
private:
int alphaMode; // alpha mode: constant alpha,blend or compose
int separateAlpha; // false if alpha is part of image data.
float alpha; // constant alpha value
float afmin, afmax; // range of alpha image values for foreground image
float abmin, abmax; // range of alpha image values for background image
int frangeSet; // has the range been explicitly set for foreground alpha?
int brangeSet; // has the range been explicitly set for background alpha?
ilCompose comp;
float mf, mb, biasf, biasb; // alpha image scaling factors
void init(ilImage* bkgd, ilImage* fore);
void resetOp();
void calcMc(float &m, float&c, float min, float max); //compute scaling factors
ilStatus doConstBlend(ilMpCacheRequest*);
ilStatus doBlend(ilMpCacheRequest*);
ilStatus doCompose(ilMpCacheRequest*);
};
#endif